package com.shopcart.request;

import com.shopcart.entity.Customer;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless(name = "CustomerControllerBean", mappedName = "ejb/CustomerControllerBean")
public class CustomerControllerBean implements CustomerController {
	@PersistenceContext
	private EntityManager em;
	private Long customerId;

	public CustomerControllerBean() {
		
	}

	public boolean loginCustomer(String username, String password) {
		System.out.println("Logging with creditentials " + username + " , " + password);
		return false;
	}

	public boolean logoutCustomer(Customer customer) {
		System.out.println("Logging out");
		return false;
	}

	@Override
	public boolean addCustomer(String name, String lastname) {
		Customer c = new Customer();
		c.setFirstName(name);
		c.setLastName(lastname);
		em.persist(c);
		return true;
	}
}